package com.demo3;

import java.lang.reflect.Proxy;

public class SmartHandlerTest {
    public static void main(String[] args) {
        ClassLoader classLoader = SmartAnimalImpl.class.getClassLoader();
        Class<?>[] interfaces = SmartAnimalImpl.class.getInterfaces();
        SmartAnimalImpl smartAnimal = new SmartAnimalImpl();

        SmartAnimal proxyInstance = (SmartAnimal)Proxy.newProxyInstance(classLoader, interfaces, new SmartHandler(smartAnimal));
        float sub = proxyInstance.getSub(12, 13);
        //System.out.println(sub);
    }
}
